package view.panel.prompt
{
	import control.panel.IPanelControl;
	
	import flash.text.TextField;
	
	import utils.TextTool;
	
	import view.panel.AbsPanel;
	
	public class AlertPanel extends AbsPanel
	{
		protected var hintText:TextField;
		public static var tempText:TextField;
		
		public function AlertPanel(panelControl:IPanelControl)
		{
			super(panelControl);
			isAlert = true;
			initText();	
			initCloseBut();
			dropShadow();
			initTweenPanelOpen();
		}
		
		private function initText():void
		{
			hintText = TextTool.getTextField(100,20,12,0xFFFFFF,false,false,"left",24);
			hintText.multiline = true;
			hintText.wordWrap = true;
			hintText.selectable = false;
			//hintText.border = true;
			//hintText.borderColor = 0xFFFFFF;
			addChild(hintText);
			if (tempText == null)
			{
				tempText = TextTool.getTextField(1000,20,12,0xFFFFFF);
			}	
		}
		
		public function alert(content:String):void
		{
			hintText.htmlText = content;
			
			tempText.htmlText = content;
			hintText.width = tempText.textWidth + 5 + 24;
			if (hintText.width > 400)
			{
				hintText.width = 400;
			}
			
			hintText.height = hintText.textHeight + 5;
			resetBg(hintText.width + 10,hintText.height + 10,1,true);
			
			hintText.x = 5;
			hintText.y = 5;
		}
	}
}